package cn.softcits.network.one;

import java.io.*;
import java.net.Socket;

/**
 * @author Rocket
 * @version 10.0.1
 * @date 2021-07-18 11:17 AM
 */
public class Client {

    public static void main(String[] args) throws Exception {

        Socket client = new Socket("192.168.0.102", 8080);

        new Thread(new ClientThread(client)).start();   // ①
        // 获取该Socket对应的输出流
        PrintStream ps = new PrintStream(client.getOutputStream());
        String line = null;
        // 不断读取键盘输入
        BufferedReader br = new BufferedReader(
                new InputStreamReader(System.in));
        while ((line = br.readLine()) != null)
        {
            // 将用户的键盘输入内容写入Socket对应的输出流
            ps.println(line);
        }

    }
}
